export const tableOption = (parentId) => {
  return {
    ...window.$crudMixins.tableOptions,
    viewBtn: false,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    labelWidth: 120,
    searchLabelWidth: 90,
    menuWidth: 200,
    dialogCustomClass: 'dialog-classify',
    span: 24,
    rowParentKey: 'parentId',
    rowKey: 'id',
    lazy: true,
    column: [
      {
        label: '标签类型',
        prop: 'name',
        span: 12,
        row: true,
        maxlength: 30,
        disabled: !!parentId && parentId !== '0',
        // addDisplay: !!parentId && parentId !== '0',
        // editDisplay: !!parentId && parentId !== '0',
        rules: [{ required: true, message: '请输入标签类型', trigger: 'blur' }],
        search: true,
      },
      {
        label: '标签名称',
        prop: 'subName',
        span: 12,
        maxlength: 30,
        addDisplay: !!parentId && parentId !== '0',
        editDisplay: !!parentId && parentId !== '0',
        rules: [{ required: true, message: '请输入标签名称', trigger: 'blur' }],
        overHidden: true,
        row: true,
        hide: true,
      },
      {
        label: '标签说明',
        prop: 'description',
        addDisplay: false,
        editDisplay: false,
        viewDisplay: false,
        overHidden: true,
      },
      {
        label: '标签用户数',
        prop: 'userCount',
        width: 160,
        addDisplay: false,
        editDisplay: false,
        viewDisplay: false,
        overHidden: true,
        hide: true,
      },
      // todo5
      {
        label: '用户自选',
        prop: 'userChoiceFlag',
        type: 'select',
        span: 24,
        search: true,
        dicData: [
          {
            label: '全部',
            value: '',
          },
          {
            label: '开启',
            value: '0',
          },
          {
            label: '关闭',
            value: '1',
          },
        ],
        rules: [
          {
            required: true,
            message: '请选择用户自选',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '标签选项类型',
        prop: 'optionType',
        type: 'radio',
        value: '1',
        // hide: true,
        span: 24,
        dicData: [
          {
            label: '单选',
            value: '0',
          },
          {
            label: '多选',
            value: '1',
          },
        ],
        rules: [
          {
            required: true,
            message: '请选择标签选项类型',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '排序',
        prop: 'sort',
        type: 'number',
        value: 99,
        width: 80,
        precision: 0,
        min: 0,
        max: 99,
        // rules: [
        //   {
        //     required: true,
        //     message: '请输入排序',
        //     trigger: 'blur',
        //   },
        // ],
        row: true,
        span: 6,
      },
      {
        label: '创建时间',
        prop: 'createTime',
        width: 160,
        addDisplay: false,
        editDisplay: false,
        viewDisplay: false,
      },
    ],
    group: [
      {
        label: '说明',
        prop: 'descriptionGroup',
        arrow: false,
        labelWidth: 0,
        column: [
          {
            placeholder: '请输入说明',
            prop: 'description',
            type: 'textarea',
            maxlength: 100,
            minRows: 7,
            showWordLimit: true,
            // rules: [{ required: true, message: '请输入说明', trigger: 'blur' }],
          },
        ],
      },
    ],
  };
};
//新增
export const insertOption = () => {
  return {
    submitBtn: false,
    emptyBtn: false,
    labelWidth: 120,
    column: [
      {
        label: '标签类型',
        prop: 'name',
        maxlength: 30,
        span: 12,
        row: true,
        rules: [
          {
            required: true,
            trigger: 'blur',
            message: '请输入标签类型',
          },
        ],
      },
      {
        label: '排序',
        prop: 'sort',
        type: 'number',
        controlsPosition: 'left',
        min: 1,
        max: 99,
        span: 12,
        row: true,
        value: '99',
        rules: [
          {
            pattern: /^[0-9]*[1-9][0-9]*$/,
            message: '排序只能输入正整数',
            trigger: 'blur',
          },
          {
            required: true,
            message: '请输入排序',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '用户自选',
        prop: 'userChoiceFlag',
        type: 'radio',
        row: true,
        disabled: true,
        span: 12,
        value: '1',
        dicData: [
          {
            label: '开启',
            value: '0',
          },
          {
            label: '关闭',
            value: '1',
          },
        ],
        rules: [
          {
            required: true,
            trigger: 'blur',
            message: '请选择用户自选',
          },
        ],
      },
      {
        label: '标签选项类型',
        prop: 'optionType',
        type: 'radio',
        value: '0',
        dicData: [
          {
            label: '单选',
            value: '0',
          },
          {
            label: '多选',
            value: '1',
          },
        ],
        rules: [
          {
            required: true,
            trigger: 'blur',
            message: '请选择标签选项类型',
          },
        ],
      },
      {
        label: '说明',
        row: true,
        span: 24,
        prop: 'description',
        type: 'textarea',
        maxlength: 50,
      },
    ],
  };
};
